;macro inc arg
;{
;  add arg,1
;}

;macro dec arg
;{
;  sub arg,1
;}
;macro loop arg
;{
;  sub  ecx,1
;  jnz  arg
;}
;macro push arg1
;{
;   sub  rsp,4
;   mov  [rsp],arg1
;}
;macro pop arg1
;{
;   mov  arg1,[rsp]
;   add  rsp,4
;}
;macro call   arg1
;{
;  sub   rsp,4
;  mov   [rsp],qword $$
;
;}
;macro ret
;{
;
;
;}

macro malloc  arg1
{
      mov     eax,arg1
      call    malloc_proc
}

macro mfree arg1
{

    mov      eax,arg1
    call     mfree_proc
}

macro pop_abi_regs
{

; push    esi esi edi ebx
;  movups  xmm0,[esp]
;  movups  [ABI_regs],xmm0
;  add     esp,16
}

macro push_abi_regs
{
;  movups  xmm0,[ABI_regs]
;  sub     esp,16
;  movups  [esp],xmm0
;  pop     ebx edi esi esi

}

macro dbg_ptr arg1
{
   push     ebx
   push     ecx
   mov      ebx,arg1
   mov      ecx,3
 @@:
   vmovups  ymm0,[ebx]
   vmovups  ymm1,[ebx+32]
   vmovups  ymm2,[ebx+64]
   vmovups  ymm3,[ebx+96]
   int3
   add      ebx,128
   loop     @b
   pop      ecx
   pop      ebx
}

macro dbg_ptr2 arg1
{
   push     ebx
   push     ecx
   mov      ebx,arg1
   mov      ecx,3
 @@:
   movups  xmm0,[ebx]
   movups  xmm1,[ebx+16]
   movups  xmm2,[ebx+32]
   movups  xmm3,[ebx+48]
   int3
   add      ebx,64
   loop     @b
   pop      ecx
   pop      ebx
}


macro dbg_ptr_lea arg1
{
   push     ebx
   push     ecx
   lea      ebx,arg1
   mov      ecx,3
 @@:
   vmovups  ymm0,[ebx]
   vmovups  ymm1,[ebx+32]
   vmovups  ymm2,[ebx+64]
   vmovups  ymm3,[ebx+96]
   int3
   add      ebx,128
   loop     @b
   pop      ecx
   pop      ebx
}


macro display_buff wid, hei, buff
{


    mov   [bmi1.biSize],sizeof.BITMAPINFOHEADER
    mov   eax,wid
    mov   [bmi1.biWidth],eax  ;XRES
    mov   edx,hei
    neg   edx
    mov [bmi1.biHeight],edx ;-YRES-30
    mov [bmi1.biPlanes],1
    mov [bmi1.biBitCount],32
    mov [bmi1.biCompression],BI_RGB

    mov [bmi1.biSizeImage],0
    mov [bmi1.biXPelsPerMeter],0
    mov [bmi1.biYPelsPerMeter],0
    mov [bmi1.biClrUsed],0
    mov [bmi1.biClrImportant],0

    invoke  StretchDIBits,[hdc],0,30,wid,hei,0,0,wid,hei,buff,bmi1,0,SRCCOPY
    invoke  Sleep,3333
}





